package net.mihome.app.view;

import android.app.Activity;
import android.content.Context;
import android.util.AttributeSet;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;

/**
 * 返回上一级的图片控件。
 * 基本上功能就是关闭当前activity
 * */
public class MiHomeBackButtonView extends Button {

	public MiHomeBackButtonView(Context context, AttributeSet attrs, int defStyle) {
		super(context, attrs, defStyle);
		afterConstructor();
		// TODO Auto-generated constructor stub
	}

	public MiHomeBackButtonView(Context context, AttributeSet attrs) {
		super(context, attrs);
		afterConstructor();
		// TODO Auto-generated constructor stub
	}

	public MiHomeBackButtonView(Context context) {
		super(context);
		afterConstructor();
		// TODO Auto-generated constructor stub
	}
	
	/**
	 * 调用构造函数之后的函数
	 * */
	public void afterConstructor(){
		this.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View arg0) {
				Activity fatherActivity=(Activity) arg0.getContext();
				fatherActivity.finish();
			}
		});
	}
}
